<!doctype html>
<html>
<head>
</head>
<body>
   <form action="" method="post">
 E-mail: <input type="text" name="email"><br>
 <input type="submit">
 </form>
    
    <?php

require_once('class.phpmailer.php');

$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->AddReplyTo("spencerNewell93@gmail.com","Spencer Newell");
$mail->SetFrom('spencerNewell93@gmail.com","Spencer Newell');

$mail->AddReplyTo('spencerNewell93@gmail.com","Spencer Newell');

$body = "This is a test... It works!";
$address = "spencerNewell93@gmail.com";
$mail->AddAddress($address, "you there");

$mail->Subject    = "A subject line here";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

//$mail->AddAttachment("images/phpmailer.gif");      // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

?>
    
        if(isset($_POST['email']))
        {
          if($_POST['email'] == NULL)
              echo "no";
          else
            $emailAddress = $_POST['email'];
        }
    $headers = 'From: localhost' . "\r\n" .
    'Reply-To: spencerNewell93@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    if(mail($emailAddress, "Your Elliphinos Receipt", "this is a test", $headers)== TRUE)
        echo "passed";
    else 
        echo "failed";
        
    ?>
    </form>
 
</body>
</html>